﻿using System.Collections.Generic;

namespace Dimebrain.TweetSharp.Core.Tasks
{
    public class TimedTaskCollection
    {
        private readonly List<TimedTask> _tasks = new List<TimedTask>(0);

        public TimedTask this[int index]
        {
            get
            {
                return _tasks[index];
            }
        }

        public void StopAll()
        {
            foreach(var task in _tasks)
            {
                task.Stop();
            }

            _tasks.Clear();
        }

        protected internal void Add(TimedTask task)
        {
            _tasks.Add(task);
        }
    }
}
